<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('avatar')->default('/static/index/images/avatar.png')->comment('头像');
            $table->string('username', 30)->default('')->comment('用户名');
            $table->string('nickname', 30)->default('')->comment('昵称');
            $table->string('mobile', 11)->default('')->comment('手机号');
            $table->unsignedInteger('user_level_id')->default(1)->comment('用户等级');
            $table->string('password')->default('JDJ5JDEwJGUvaXZQcUMvbHBFcHUvVm16RWRrbU9ROFROYlMvMktwZnZqaGhWQ29uUi5GTGQ5Sng3SzlD')->comment('密码');
            $table->tinyInteger('status')->default(1)->comment('是否启用 0：否 1：是');
            $table->text('description')->comment('描述');
            $table->timestamp('created_at')->default('0000-00-00 00:00:00')->comment('创建时间');
            $table->timestamp('updated_at')->default('0000-00-00 00:00:00')->comment('更新时间');
            $table->softDeletes()->default('0000-00-00 00:00:00')->comment('删除时间');
            $table->tinyInteger('is_distributor')->default(0)->comment('是否是分销商 0--不是 1--是 2--申请中');
            $table->timestamp('share_time')->nullable()->default('0000-00-00 00:00:00')->comment('成为分销商的时间');
            $table->decimal('money', 10)->default(0.00)->comment('余额');
            $table->string('last_token')->nullable();
            $table->string('openid')->nullable()->comment('微信OPENID');
            $table->string('unionid')->default('')->comment('微信开发平台UnionID');
            $table->integer('store_id')->default(0)->comment('店铺ID，默认0');
            $table->boolean('gender')->default(0)->comment('性别');
            $table->string('session_key')->default('')->comment('微信解密session_key');
            $table->decimal('integral', 10)->default(0.00)->comment('积分');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
